home *** CD-ROM | disk | FTP | other *** search
Wrap
card_3026.xml <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" > <card> <id>3026</id> <filler1>0</filler1> <bitmap>BMAP_4493.pbm</bitmap> <cantDelete> <false /> </cantDelete> <showPict> <true /> </showPict> <dontSearch> <false /> </dontSearch> <owner>2719</owner> <link rel="stylesheet" type="text/css" href="stylesheet_3212.css" /> <part> <id>1</id> <type>button</type> <visible> <true /> </visible> <reserved5> 0 </reserved5> <reserved4> 0 </reserved4> <reserved3> 0 </reserved3> <reserved2> 0 </reserved2> <reserved1> 0 </reserved1> <enabled> <true /> </enabled> <rect> <left>13</left> <top>8</top> <right>245</right> <bottom>67</bottom> </rect> <style>roundrect</style> <showName> <true /> </showName> <highlight> <false /> </highlight> <autoHighlight> <true /> </autoHighlight> <sharedHighlight> <true /> </sharedHighlight> <family>0</family> <titleWidth>0</titleWidth> <icon>0</icon> <textAlign>center</textAlign> <font>Chicago</font> <textSize>24</textSize> <textStyle>outline</textStyle> <name>RTF Import</name> <script>on mouseUp global Dest ------------------------------------------------------------ --put the name of the destination field of the RTF text --into the variable Dest ------------------------------------------------------------ put "Import" into Dest ------------------------------------------------------------ -- This code runs ONLY on HC 2.0 and up. -- To be cautious, we check the version of HyperCard running. if the version < 2.0 then answer "Sorry, you need HyperCard 2.0 or better." with "OK" exit mouseUp end if ------------------------------------------------------------ answer file "Pick an RTF file." of type "TEXT" if it is empty then exit mouseup set the cursor to watch lock Screen put it into MyFile open file MyFile read from file MyFile until NumToChar(3) --EOF put it into FilteredText --------------------------------------------------------- --First, we separate the different bodies of the RTF file --and we generate some reference tables from them --------------------------------------------------------- --The first body is the definition with the font table --------------------------------------------------------- put char 1 to offset("}}",FilteredText) of FilteredText after Header --We find the metaCharacters repeat with MyChar = 1 to (the length of Header) set cursor to busy if (char MyChar of Header) = "{" or (char MyChar of Header) = "}" then put RETURN after HeadTbl else if (char MyChar of FilteredText) = "\" then put RETURN after HeadTbl else put char MyChar of FilteredText after HeadTbl end if end repeat --This gives us a table with items separated by returns and tabs if (word 1 of HeadTbl) ≠"rtf1" or (word 3 of HeadTbl) ≠"deff2" then answer "This is not a supported version of RTF file." with "OK" close file MyFile exit mouseup end if --We checked for the right type of RTF file --We can now eliminate the header and keep the font table only delete line 1 to 8 of HeadTbl repeat (the number of lines of HeadTbl) put offset(RETURN&RETURN,HeadTbl) into DblRet if DblRet ≠ 0 then delete char DblRet to (DblRet + 1) of HeadTbl put RETURN before char DblRet of HeadTbl else exit repeat end if end repeat repeat with LineNo = 1 to (the number of lines of HeadTbl div 2) delete word 1 of line (LineNo * 2) of HeadTbl delete last char of line (LineNo * 2) of HeadTbl end repeat --We eliminate the Header from the FilteredText delete char 1 to offset("}}",FilteredText) of FilteredText -- --------------------------------------------------------- --The second body is the colour table --Since HC doesn't support colour yet, we simply eliminate --it from the FilteredText and ignore this body ---------------------------------------------------------- delete char 1 to offset("}}",FilteredText) of FilteredText ---------------------------------------------------------- --The third and fourth body are the stylesheet table --and the info sheet table. --Since supporting this feature would demand very complex --programming structures for text rarely bigger than --16 384 caracters, we decided to ignore it too --The info doesn't serve any purpose in HC, we drop it too ---------------------------------------------------------- delete char 1 to offset("}}",FilteredText) of FilteredText ---------------------------------------------------------- --The fifth body is the general page reference table --Since HC fields do not support layouts, we drop it too ---------------------------------------------------------- delete char 1 to offset("{",FilteredText) of FilteredText ---------------------------------------------------------- --Finally, the last part is the encoded text --We decode it to express all the special characters of --the Macintosh character set while giving it the right --set of Font, style and size --Note: It is imperative to remove any carriage returns --in the encoded text since it is hardcoded as "\par" anyway. ---------------------------------------------------------- repeat (length(FilteredText)) put offset(RETURN, FilteredText) into Spot if Spot ≠ 0 then delete char Spot of FilteredText else exit repeat end if end repeat ---------------------------------------------------------- put FilteredText into cd fld Dest repeat (the length of cd fld Dest) set cursor to busy put offset("{",cd fld Dest) into LeftBraket put offset("}",cd fld Dest) into RightBraket if (LeftBraket ≠ 0) or (RightBraket ≠ 0) then if (LeftBraket ≠ 0) then delete char LeftBraket of cd fld Dest end if if (RightBraket ≠ 0) then delete char RightBraket of cd fld Dest end if else exit repeat end if end repeat ---------------------------------------------------------- --INTERPRETING CHARACTERS ---------------------------------------------------------- --interpreting special characters repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\'",cd fld Dest) into MetaCharLoc put the Selection into basicString if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 3) of cd fld Dest type HandleCharacters(basicString) else exit repeat end if end repeat --interpreting carriage returns and page change repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\par",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 4) of cd fld Dest type RETURN else exit repeat end if end repeat repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\page",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then delete char MetaCharLoc to (MetaCharLoc + 5) of cd fld Dest else exit repeat end if end repeat --interpreting tabulations --Note: tabulations move the cursor from field to field, it is --not possible to enter a real tab in a field. To fix this, --we enter four spaces to simulate a tab character. repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\tab",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 3) of cd fld Dest type " " else exit repeat end if end repeat --interpreting bullets repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\bullet",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest type "•" else exit repeat end if end repeat --interpreting emdash repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\emdash",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest type "–" else exit repeat end if end repeat --interpreting endash repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\endash",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest type "—" else exit repeat end if end repeat --interpreting left simple quotes repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\lquote",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest type "‘" else exit repeat end if end repeat --interpreting left double quotes repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\ldblquote",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 10) of cd fld Dest type "“" else exit repeat end if end repeat --interpreting right simple quotes repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\rquote",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest type "’" else exit repeat end if end repeat --interpreting right double quotes repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\rdblquote",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 10) of cd fld Dest type "”" else exit repeat end if end repeat --interpreting left accolade repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\{",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 1) of cd fld Dest type "{" else exit repeat end if end repeat --interpreting right accolade repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\}",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 1) of cd fld Dest type "}" else exit repeat end if end repeat --interpreting slash repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\\",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then select char MetaCharLoc to (MetaCharLoc + 1) of cd fld Dest type "\" else exit repeat end if end repeat --------------------------------------------------------------- -- ELIMINATING NON-NECESSARY ENCODING --------------------------------------------------------------- repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\qj",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then delete char MetaCharLoc to (MetaCharLoc + 2) of cd fld Dest else exit repeat end if end repeat -- repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\ril",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then delete char MetaCharLoc to (MetaCharLoc + 3) of cd fld Dest else exit repeat end if end repeat -- repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\tlul",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then delete char MetaCharLoc to (MetaCharLoc + 4) of cd fld Dest else exit repeat end if end repeat -- repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\tqr",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then delete char MetaCharLoc to (MetaCharLoc + 3) of cd fld Dest else exit repeat end if end repeat -- repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\tx",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then if char (MetaCharLoc + 6) of cd fld Dest ≠ " " or ¬ char (MetaCharLoc + 6) of cd fld Dest ≠ "\" then delete char MetaCharLoc to (MetaCharLoc + 5) of cd fld Dest else delete char MetaCharLoc to (MetaCharLoc + 6) of cd fld Dest end if else exit repeat end if end repeat -- repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\ri1",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then if char (MetaCharLoc + 6) of cd fld Dest ≠ " " or ¬ char (MetaCharLoc + 6) of cd fld Dest ≠ "\" then delete char MetaCharLoc to (MetaCharLoc + 6) of cd fld Dest else delete char MetaCharLoc to (MetaCharLoc + 7) of cd fld Dest end if else exit repeat end if end repeat ----------------------------------------------------------- --INTERPRETING FONTS AND STYLES (SIZE,STYLE) ----------------------------------------------------------- --interpreting size ----------------------------------------------------------- repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\fs",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then put (char (MetaCharLoc + 3) of cd fld Dest)&¬ (char (MetaCharLoc + 4) of cd fld Dest) into TempSize put TempSize div 2 into MySize put MetaCharLoc into StartSize delete char MetaCharLoc to (MetaCharLoc + 4) of cd fld Dest put offset("\fs",cd fld Dest) into StopSize if StopSize = 0 then set the textsize of char StartSize to ¬ (the length of cd fld Dest) of cd fld Dest to MySize else set the textsize of char StartSize to StopSize of¬ cd fld Dest to MySize end if else exit repeat end if end repeat ------------------------------------------------------------------ -- Interpreting fonts ------------------------------------------------------------------ repeat (the length of cd fld Dest div 2) -- The maximum encoded size set cursor to busy put offset("\f",cd fld Dest) into MetaCharLoc if MetaCharLoc ≠ 0 then -- We have to check the extent of the ID code (1,2,3,4 or 5 digits) if char (MetaCharLoc + 7) of cd fld Dest = " "¬ or char (MetaCharLoc + 7) of cd fld Dest = "\" then put char (MetaCharLoc + 1) to (MetaCharLoc + 6) ¬ of cd fld Dest into MyFontID end if if char (MetaCharLoc + 6) of cd fld Dest = " "¬ or char (MetaCharLoc + 6) of cd fld Dest = "\" then put char (MetaCharLoc + 1) to (MetaCharLoc + 5) ¬ of cd fld Dest into MyFontID end if if char (MetaCharLoc + 5) of cd fld Dest = " "¬ or char (MetaCharLoc + 5) of cd fld Dest = "\" then put char (MetaCharLoc + 1) to (MetaCharLoc + 4) ¬ of cd fld Dest into MyFontID end if if char (MetaCharLoc + 4) of cd fld Dest = " "¬ or char (MetaCharLoc + 4) of cd fld Dest = "\" then put char (MetaCharLoc + 1) to (MetaCharLoc + 3) ¬ of cd fld Dest into MyFontID end if if char (MetaCharLoc + 3) of cd fld Dest = " "¬ or char (MetaCharLoc + 3) of cd fld Dest = "\" then put char (MetaCharLoc + 1) to (MetaCharLoc + 2) ¬ of cd fld Dest into MyFontID end if put true into FontNotAvailbl repeat with LineNo = 1 to ((the number of lines of HeadTbl) div 2) if line ((LineNo * 2) - 1) of HeadTbl = MyFontID then put line (LineNo * 2) of HeadTbl into MyFont put false into FontNotAvailbl end if end repeat if FontNotAvaibl is true then answer "Font not available. Chicago used instead." with "OK" put "Chicago" into MyFont -- Note : if the Font ID is the same but the Font isn't, -- the program will not be able to set the font accordingly -- and may crash. HC cannot help us on this. end if delete char MetaCharLoc to (MetaCharLoc + length(MyFontID)) ¬ of cd fld Dest put MetaCharLoc into StartFont put offset("\f",cd fld Dest) into StopFont if StopFont = 0 then set the textFont of char StartFont to ¬ (the length of cd fld Dest) of cd fld Dest to MyFont else set the textFont of char StartFont to StopFont of¬ cd fld Dest to MyFont end if else exit repeat end if end repeat ------------------------------------------------------------------ --interpreting style --(bold, italic, underline, outline, shadow) ------------------------------------------------------------------ HandleStyles -- Note : the separate handler was used to lighten this handler. ------------------------------------------------------------------ --The Filtered Text remains close file MyFile unlock Screen end mouseUp function HandleCharacters TheString -----interpreting special characters put 1 into theStrChar if (char (theStrChar +2) of TheString)="8" then if (char (theStrChar +3) of TheString)="1" then return "Å" if (char (theStrChar +3) of TheString)="2" then return "Ç" if (char (theStrChar +3) of TheString)="3" then return "É" if (char (theStrChar +3) of TheString)="7" then return "á" if (char (theStrChar +3) of TheString)="8" then return "à" if (char (theStrChar +3) of TheString)="9" then return "â" if (char (theStrChar +3) of TheString)="a" then return "ä" if (char (theStrChar +3) of TheString)="b" then return "ã" if (char (theStrChar +3) of TheString)="c" then return "å" if (char (theStrChar +3) of TheString)="d" then return "ç" if (char (theStrChar +3) of TheString)="e" then return "é" if (char (theStrChar +3) of TheString)="f" then return "è" end if if (char (theStrChar +2) of TheString)="9" then if (char (theStrChar +3) of TheString)="0" then return "ê" if (char (theStrChar +3) of TheString)="1" then return "ë" if (char (theStrChar +3) of TheString)="2" then return "í" if (char (theStrChar +3) of TheString)="3" then return "ì" if (char (theStrChar +3) of TheString)="4" then return "î" if (char (theStrChar +3) of TheString)="5" then return "ï" if (char (theStrChar +3) of TheString)="6" then return "ñ" if (char (theStrChar +3) of TheString)="7" then return "ó" if (char (theStrChar +3) of TheString)="8" then return "ò" if (char (theStrChar +3) of TheString)="9" then return "ô" if (char (theStrChar +3) of TheString)="a" then return "ä" if (char (theStrChar +3) of TheString)="b" then return "õ" if (char (theStrChar +3) of TheString)="c" then return "ú" if (char (theStrChar +3) of TheString)="d" then return "ù" if (char (theStrChar +3) of TheString)="e" then return "û" if (char (theStrChar +3) of TheString)="f" then return "ü" end if if (char (theStrChar +2) of TheString)="a" then if (char (theStrChar +3) of TheString)="0" then return "†" if (char (theStrChar +3) of TheString)="1" then return "°" if (char (theStrChar +3) of TheString)="2" then return "¢" if (char (theStrChar +3) of TheString)="3" then return "£" if (char (theStrChar +3) of TheString)="4" then return "§" if (char (theStrChar +3) of TheString)="6" then return "¶" if (char (theStrChar +3) of TheString)="7" then return "ß" if (char (theStrChar +3) of TheString)="8" then return "®" if (char (theStrChar +3) of TheString)="9" then return "©" if (char (theStrChar +3) of TheString)="a" then return "™" if (char (theStrChar +3) of TheString)="b" then return "´" if (char (theStrChar +3) of TheString)="c" then return "¨" if (char (theStrChar +3) of TheString)="d" then return "≠" if (char (theStrChar +3) of TheString)="e" then return "Æ" if (char (theStrChar +3) of TheString)="f" then return "Ø" end if if (char (theStrChar +2) of TheString)="b" then if (char (theStrChar +3) of TheString)="0" then return "∞" if (char (theStrChar +3) of TheString)="1" then return "±" if (char (theStrChar +3) of TheString)="2" then return "≤" if (char (theStrChar +3) of TheString)="3" then return "≥" if (char (theStrChar +3) of TheString)="4" then return "¥" if (char (theStrChar +3) of TheString)="5" then return "µ" if (char (theStrChar +3) of TheString)="6" then return "∂" if (char (theStrChar +3) of TheString)="7" then return "∑" if (char (theStrChar +3) of TheString)="8" then return "∏" if (char (theStrChar +3) of TheString)="9" then return "π" if (char (theStrChar +3) of TheString)="a" then return "∫" if (char (theStrChar +3) of TheString)="b" then return "ª" if (char (theStrChar +3) of TheString)="c" then return "º" if (char (theStrChar +3) of TheString)="d" then return "Ω" if (char (theStrChar +3) of TheString)="e" then return "æ" if (char (theStrChar +3) of TheString)="f" then return "ø" end if if (char (theStrChar +2) of TheString)="c" then if (char (theStrChar +3) of TheString)="0" then return "¿" if (char (theStrChar +3) of TheString)="1" then return "¡" if (char (theStrChar +3) of TheString)="2" then return "¬" if (char (theStrChar +3) of TheString)="3" then return "√" if (char (theStrChar +3) of TheString)="4" then return "ƒ" if (char (theStrChar +3) of TheString)="5" then return "≈" if (char (theStrChar +3) of TheString)="6" then return "∆" if (char (theStrChar +3) of TheString)="7" then return "«" if (char (theStrChar +3) of TheString)="8" then return "»" if (char (theStrChar +3) of TheString)="9" then return "…" if (char (theStrChar +3) of TheString)="e" then return "Œ" if (char (theStrChar +3) of TheString)="f" then return "œ" end if if (char (theStrChar +2) of TheString)="d" then if (char (theStrChar +3) of TheString)="6" then return "÷" if (char (theStrChar +3) of TheString)="7" then return "◊" if (char (theStrChar +3) of TheString)="8" then return "ÿ" if (char (theStrChar +3) of TheString)="9" then return "Ÿ" if (char (theStrChar +3) of TheString)="a" then return "/" if (char (theStrChar +3) of TheString)="b" then return "€" if (char (theStrChar +3) of TheString)="c" then return "‹" if (char (theStrChar +3) of TheString)="d" then return "›" if (char (theStrChar +3) of TheString)="f" then return "fl" end if if (char (theStrChar +2) of TheString)="e" then if (char (theStrChar +3) of TheString)="0" then return "‡" if (char (theStrChar +3) of TheString)="1" then return "·" if (char (theStrChar +3) of TheString)="3" then return "„" if (char (theStrChar +3) of TheString)="4" then return "‰" if (char (theStrChar +3) of TheString)="5" then return "Â" if (char (theStrChar +3) of TheString)="6" then return "Ê" if (char (theStrChar +3) of TheString)="7" then return "Á" if (char (theStrChar +3) of TheString)="8" then return "Ë" if (char (theStrChar +3) of TheString)="9" then return "È" if (char (theStrChar +3) of TheString)="a" then return "Í" if (char (theStrChar +3) of TheString)="b" then return "Î" if (char (theStrChar +3) of TheString)="c" then return "Ï" if (char (theStrChar +3) of TheString)="d" then return "Ì" if (char (theStrChar +3) of TheString)="e" then return "Ó" if (char (theStrChar +3) of TheString)="f" then return "Ô" end if if (char (theStrChar +2) of TheString)="f" then if (char (theStrChar +3) of TheString)="0" then return "" if (char (theStrChar +3) of TheString)="1" then return "Ò" if (char (theStrChar +3) of TheString)="2" then return "Ú" if (char (theStrChar +3) of TheString)="3" then return "Û" if (char (theStrChar +3) of TheString)="4" then return "Ù" if (char (theStrChar +3) of TheString)="5" then return "ı" if (char (theStrChar +3) of TheString)="a" then return "˙" if (char (theStrChar +3) of TheString)="b" then return "˚" end if end HandleCharacters on HandleStyles global Dest repeat (the length of cd fld Dest div 2) --The maximum encoded size set cursor to busy put offset("\b",cd fld Dest) into BoldLoc put offset("\i",cd fld Dest) into ItalicLoc put offset("\ul",cd fld Dest) into ULineLoc put offset("\outl",cd fld Dest) into OutLineLoc put offset("\shad",cd fld Dest) into ShadowLoc if (BoldLoc = 0) and (ItalicLoc = 0) and (ULineLoc = 0) and¬ (OutLineLoc = 0) and (ShadowLoc = 0) then exit repeat else put empty into StyleList if BoldLoc = 0 then put "100000," after StyleList else put BoldLoc&"," after StyleList if ItalicLoc = 0 then put "100000," after StyleList else put ItalicLoc&"," after StyleList if ULineLoc = 0 then put "100000," after StyleList else put ULineLoc&"," after StyleList if OutLineLoc = 0 then put "100000," after StyleList else put OutLineLoc&"," after StyleList if ShadowLoc = 0 then put "100000" after StyleList else put ShadowLoc after StyleList put min(StyleList) into MetaCharLoc end if -------------------------------------------------------------------- -- 100000 ensures us that the absent style (0) won't be the minimum -------------------------------------------------------------------- if MetaCharLoc ≠ "100000" then put empty into MyStyle repeat with PresentChar = MetaCharLoc to (length(cd fld Dest)) if char PresentChar of cd fld Dest = " " ¬ and char (PresentChar + 1) of cd fld Dest ≠ "\" then delete char MetaCharLoc to PresentChar of cd fld Dest exit repeat else put char PresentChar of cd fld Dest after MyStyle end if end repeat repeat with PresentChar = 1 to (length(MyStyle) div 2) put offset("\b",MyStyle) into BoldLoc put offset("\i",MyStyle) into ItalicLoc put offset("\ul",MyStyle) into ULineLoc put offset("\outl",MyStyle) into OutLineLoc put offset("\shad",MyStyle) into ShadowLoc if BoldLoc ≠ 0 then if char (PresentChar + 2) of MyStyle = " " then delete char PresentChar to (PresentChar + 2) of MyStyle else delete char PresentChar to (PresentChar + 1) of MyStyle end if put "bold," before char PresentChar of MyStyle end if if ItalicLoc ≠ 0 then if char (PresentChar + 2) of MyStyle = " " then delete char PresentChar to (PresentChar + 2) of MyStyle else delete char PresentChar to (PresentChar + 1) of MyStyle end if put "italic," before char PresentChar of MyStyle end if if ULineLoc ≠ 0 then if char (PresentChar + 3) of MyStyle = " " then delete char PresentChar to (PresentChar + 3) of MyStyle else delete char PresentChar to (PresentChar + 2) of MyStyle end if put "underline," before char PresentChar of MyStyle end if if OutLineLoc ≠ 0 then if char (PresentChar + 5) of MyStyle = " " then delete char PresentChar to (PresentChar + 5) of MyStyle else delete char PresentChar to (PresentChar + 4) of MyStyle end if put "outline," before char PresentChar of MyStyle end if if ShadowLoc ≠ 0 then if char (PresentChar + 5) of MyStyle = " " then delete char PresentChar to (PresentChar + 5) of MyStyle else delete char PresentChar to (PresentChar + 4) of MyStyle end if put "shadow," before char PresentChar of MyStyle end if end repeat delete last char of MyStyle put MetaCharLoc into StartStyle repeat with PresentChar = MetaCharLoc to (length(cd fld Dest)) put (char PresentChar of cd fld Dest)&(char (PresentChar + 1)¬ of cd fld Dest) into testString if testString = " " or testString = " "&RETURN or ¬ testString = RETURN&RETURN then put PresentChar into StopStyle exit repeat end if end repeat if StopStyle = 0 then set the textstyle of char StartStyle to ¬ (the length of cd fld Dest) of cd fld Dest to MyStyle else set the textstyle of char StartStyle to StopStyle of¬ cd fld Dest to MyStyle end if else exit repeat end if end repeat end HandleStyles</script> </part> <part> <id>3</id> <type>field</type> <visible> <true /> </visible> <dontWrap> <false /> </dontWrap> <dontSearch> <false /> </dontSearch> <sharedText> <false /> </sharedText> <fixedLineHeight> <false /> </fixedLineHeight> <autoTab> <false /> </autoTab> <lockText> <false /> </lockText> <rect> <left>13</left> <top>72</top> <right>466</right> <bottom>265</bottom> </rect> <style>scrolling</style> <autoSelect> <false /> </autoSelect> <showLines> <false /> </showLines> <wideMargins> <false /> </wideMargins> <multipleLines> <false /> </multipleLines> <reservedFamily> 0 </reservedFamily> <titleWidth>0</titleWidth> <icon>0</icon> <textAlign>left</textAlign> <font>Times</font> <textSize>9</textSize> <textStyle>plain</textStyle> <textHeight>12</textHeight> <name>Import</name> <script></script> </part> <part> <id>5</id> <type>button</type> <visible> <true /> </visible> <reserved5> 0 </reserved5> <reserved4> 0 </reserved4> <reserved3> 0 </reserved3> <reserved2> 0 </reserved2> <reserved1> 0 </reserved1> <enabled> <true /> </enabled> <rect> <left>405</left> <top>9</top> <right>436</right> <bottom>66</bottom> </rect> <style>transparent</style> <showName> <false /> </showName> <highlight> <false /> </highlight> <autoHighlight> <true /> </autoHighlight> <sharedHighlight> <true /> </sharedHighlight> <family>0</family> <titleWidth>0</titleWidth> <icon>902</icon> <textAlign>center</textAlign> <font>Chicago</font> <textSize>12</textSize> <textStyle>plain</textStyle> <name>Go</name> <script>on mouseUp go prev card end mouseUp</script> </part> <part> <id>6</id> <type>button</type> <visible> <true /> </visible> <reserved5> 0 </reserved5> <reserved4> 0 </reserved4> <reserved3> 0 </reserved3> <reserved2> 0 </reserved2> <reserved1> 0 </reserved1> <enabled> <true /> </enabled> <rect> <left>435</left> <top>9</top> <right>466</right> <bottom>66</bottom> </rect> <style>transparent</style> <showName> <false /> </showName> <highlight> <false /> </highlight> <autoHighlight> <true /> </autoHighlight> <sharedHighlight> <true /> </sharedHighlight> <family>0</family> <titleWidth>0</titleWidth> <icon>20098</icon> <textAlign>center</textAlign> <font>Chicago</font> <textSize>12</textSize> <textStyle>plain</textStyle> <name>Go</name> <script>on mouseUp go home end mouseUp</script> </part> <part> <id>8</id> <type>button</type> <visible> <true /> </visible> <reserved5> 0 </reserved5> <reserved4> 0 </reserved4> <reserved3> 0 </reserved3> <reserved2> 0 </reserved2> <reserved1> 0 </reserved1> <enabled> <true /> </enabled> <rect> <left>246</left> <top>34</top> <right>280</right> <bottom>67</bottom> </rect> <style>transparent</style> <showName> <false /> </showName> <highlight> <false /> </highlight> <autoHighlight> <true /> </autoHighlight> <sharedHighlight> <true /> </sharedHighlight> <family>0</family> <titleWidth>0</titleWidth> <icon>14767</icon> <textAlign>center</textAlign> <font>Chicago</font> <textSize>12</textSize> <textStyle>plain</textStyle> <name>Go</name> <script>on mouseUp show card fld 2 end mouseUp</script> </part> <part> <id>9</id> <type>field</type> <visible> <false /> </visible> <dontWrap> <false /> </dontWrap> <dontSearch> <false /> </dontSearch> <sharedText> <false /> </sharedText> <fixedLineHeight> <false /> </fixedLineHeight> <autoTab> <false /> </autoTab> <lockText> <true /> </lockText> <rect> <left>13</left> <top>7</top> <right>466</right> <bottom>68</bottom> </rect> <style>shadow</style> <autoSelect> <false /> </autoSelect> <showLines> <false /> </showLines> <wideMargins> <true /> </wideMargins> <multipleLines> <false /> </multipleLines> <reservedFamily> 0 </reservedFamily> <titleWidth>0</titleWidth> <icon>0</icon> <textAlign>center</textAlign> <font>Geneva</font> <textSize>12</textSize> <textStyle>plain</textStyle> <textHeight>16</textHeight> <name></name> <script>on mouseUp hide me end mouseUp</script> </part> <content> <layer>card</layer> <id>4</id> <text>Yet to check: -styles </text> </content> <content> <layer>card</layer> <id>9</id> <text><span class="style40">o learn more on the process of importing Rich Text File into HyperCard 2.0, read the script of the button "RTF Import".</span><span class="style1"> </span><span class="style32">-click me to remove message-</span></text> </content> <name></name> <script></script> </card> card_4255.xml <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" > <card> <id>4255</id> <filler1>0</filler1> <bitmap>BMAP_4699.pbm</bitmap> <cantDelete> <false /> </cantDelete> <showPict> <true /> </showPict> <dontSearch> <false /> </dontSearch> <owner>2719</owner> <link rel="stylesheet" type="text/css" href="stylesheet_3212.css" /> <part> <id>1</id> <type>field</type> <visible> <true /> </visible> <dontWrap> <false /> </dontWrap> <dontSearch> <false /> </dontSearch> <sharedText> <false /> </sharedText> <fixedLineHeight> <false /> </fixedLineHeight> <autoTab> <false /> </autoTab> <lockText> <true /> </lockText> <rect> <left>28</left> <top>13</top> <right>336</right> <bottom>260</bottom> </rect> <style>shadow</style> <autoSelect> <false /> </autoSelect> <showLines> <false /> </showLines> <wideMargins> <true /> </wideMargins> <multipleLines> <false /> </multipleLines> <reservedFamily> 0 </reservedFamily> <titleWidth>0</titleWidth> <icon>0</icon> <textAlign>center</textAlign> <font>Geneva</font> <textSize>12</textSize> <textStyle>plain</textStyle> <textHeight>16</textHeight> <name></name> <script></script> </part> <part> <id>2</id> <type>button</type> <visible> <true /> </visible> <reserved5> 0 </reserved5> <reserved4> 0 </reserved4> <reserved3> 0 </reserved3> <reserved2> 0 </reserved2> <reserved1> 0 </reserved1> <enabled> <true /> </enabled> <rect> <left>342</left> <top>219</top> <right>450</right> <bottom>258</bottom> </rect> <style>transparent</style> <showName> <false /> </showName> <highlight> <false /> </highlight> <autoHighlight> <true /> </autoHighlight> <sharedHighlight> <true /> </sharedHighlight> <family>0</family> <titleWidth>0</titleWidth> <icon>26425</icon> <textAlign>center</textAlign> <font>Chicago</font> <textSize>12</textSize> <textStyle>plain</textStyle> <name>Go</name> <script>on mouseUp go next card end mouseUp</script> </part> <content> <layer>card</layer> <id>1</id> <text><span class="style31">TF Import </span><span class="style1"> </span><span class="style32">HyperTalk 2.0</span><span class="style33"> script for RTF importing brought to you by</span><span class="style1"> </span><span class="style34">Francis Keith Bourgoin</span><span class="style1"> </span><span class="style13">for the</span><span class="style1"> </span><span class="style37">Club Macintosh de Québec (CMQ) </span><span class="style1"> </span><span class="style38">the largest french Macintosh Club in North America</span><span class="style1"> </span><span class="style13">To contact </span><span class="style39">Keith Bourgoin</span><span class="style13"> (AOL : FKBourgoin) (InterNet : KBourgoin@fse.ulaval.ca) </span><span class="style39">Club Macintosh de Québec</span><span class="style13"> (418) 657-6916</span></text> </content> <name></name> <script></script> </card>